package com.hsh.server.project.bank.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.hsh.server.common.controller.BaseController;
import com.hsh.server.project.bank.domain.TAppAccount;
import com.hsh.server.project.bank.service.ITAppAccountService;
import com.hsh.server.util.R;
import com.hsh.server.util.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 账户Controller
 * 
 * @author ruoyi
 * @date 2025-04-23
 */
@RestController
@RequestMapping("/system/account")
public class TAppAccountController extends BaseController
{
    @Autowired
    private ITAppAccountService tAppAccountService;

    /**
     * 查询账户列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TAppAccount tAppAccount)
    {
        startPage();
        List<TAppAccount> list = tAppAccountService.selectTAppAccountList(tAppAccount);
        return getDataTable(list);
    }

    /**
     * 获取账户详细信息
     */
    @GetMapping(value = "/{id}")
    public R getInfo(@PathVariable("id") Long id)
    {
        return R.success(tAppAccountService.selectTAppAccountById(id));
    }

    /**
     * 新增账户
     */
    @PostMapping
    public R add(@RequestBody TAppAccount tAppAccount)
    {
        return R.success(tAppAccountService.insertTAppAccount(tAppAccount));
    }

    /**
     * 修改账户
     */
    @PutMapping
    public R edit(@RequestBody TAppAccount tAppAccount)
    {
        return R.success(tAppAccountService.updateTAppAccount(tAppAccount));
    }

    /**
     * 删除账户
     */
	@DeleteMapping("/{ids}")
    public R remove(@PathVariable Long[] ids)
    {
        return R.success(tAppAccountService.deleteTAppAccountByIds(ids));
    }
}
